package com.psytech.app.task.web_ui.client;

import java.util.Date;

import com.psytech.app.task.web_ui.shared.UIComment;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class CommentRecord extends ListGridRecord {

	UIComment uiComment;

	public CommentRecord() {
	}

	public CommentRecord(final UIComment uiComment) {
		this.uiComment = uiComment;
		this.setAttribute("text", uiComment.getText());
		this.setAttribute("writer", uiComment.getWriter().getLogin());
		this.setAttribute("creationDate", uiComment.getCreationDate());
		this.setAttribute("uid", uiComment.getUid());
		this.setAttribute("taskUid", uiComment.getTaskUid());
	}

	public String getText() {
		return getAttributeAsString("text");
	}

	public String getWriterName() {
		return getAttributeAsString("writer");
	}

	public Date getCreationDate() {
		return getAttributeAsDate("creationDate");
	}

	public UIComment getInnerUiComment() {
		return uiComment;
	}
}
